<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Butterfly魔改系列🦋扩展功能和特效 | 小李博客</title><meta name="keywords" content="Hexo"><meta name="author" content="小李博客"><meta name="copyright" content="小李博客"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="扩展功能友情链接 打开Basn命令  1hexo new page link   找到C:\[rootblog]\source\link\index.md  12345---title: 友情链接date: 2020-06-03 17:53:02type: link---   在C:\[rootblog]\source\ 目录下新建_data 文件夹，文件夹内新建 link.yml  123456">
<meta property="og:type" content="article">
<meta property="og:title" content="Butterfly魔改系列🦋扩展功能和特效">
<meta property="og:url" content="http://xiaoliblog.cn/page/butterfly02.html">
<meta property="og:site_name" content="小李博客">
<meta property="og:description" content="扩展功能友情链接 打开Basn命令  1hexo new page link   找到C:\[rootblog]\source\link\index.md  12345---title: 友情链接date: 2020-06-03 17:53:02type: link---   在C:\[rootblog]\source\ 目录下新建_data 文件夹，文件夹内新建 link.yml  123456">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2b4802e64dda1cdfead2db084a07b179beaff7dc/2021/03/29/082954b9ca0f481522271eaecce8d840.png">
<meta property="article:published_time" content="2020-12-02T16:00:00.000Z">
<meta property="article:modified_time" content="2021-04-24T14:32:19.954Z">
<meta property="article:author" content="小李博客">
<meta property="article:tag" content="Hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2b4802e64dda1cdfead2db084a07b179beaff7dc/2021/03/29/082954b9ca0f481522271eaecce8d840.png"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6b5e7ef72be1c8973d94e5a9c49accbf775ad820/2021/02/01/c485da031fe0e464d04eaba8a66c4a8f.png"><link rel="canonical" href="http://xiaoliblog.cn/page/butterfly02"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.js" defer></script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: {"appId":"RTG4CPNBLJ","apiKey":"f1745bdad68ceec57653b78244fe332c","indexName":"MyBlogIndex","hits":{"per_page":6},"languages":{"input_placeholder":"搜索文章","hits_empty":"找不到您查询的内容：${query}","hits_stats":"找到 ${hits} 条结果，用时 ${time} 毫秒"}},
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":100,"languages":{"author":"作者: 小李博客","link":"链接: ","source":"来源: 小李博客","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'mediumZoom',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"top-center"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-04-24 22:32:19'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const fontSizeVal = saveToLocal.get('global-font-size')
    if (fontSizeVal !== undefined) {
      document.documentElement.style.setProperty('--global-font-size', fontSizeVal + 'px')
    }
    })(window)</script><link rel="stylesheet" href="/css/MyStyle/MyStyle.css" media="defer" onload="this.media='all'"/><link rel="stylesheet" href="/css/MyStyle/tagStyle.css" media="defer" onload="this.media='all'"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zykjofficial/zykjresource@master/css/font-awesome-animation.min.css" media="defer" onload="this.media='all'"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/font-awesome-animation.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/plugins.min.css" media="defer" onload="this.media='all'"><meta name="generator" content="Hexo 5.2.0"><link rel="alternate" href="/atom.xml" title="小李博客" type="application/atom+xml">
</head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6b5e7ef72be1c8973d94e5a9c49accbf775ad820/2021/02/01/c485da031fe0e464d04eaba8a66c4a8f.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">210</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">38</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">56</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/box/"><i class="fa-fw fa fa-briefcase"></i><span> 工具箱</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-book"></i><span> 找文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fa fa-address-card"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="not-top-img" id="page-header"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">小李博客</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/box/"><i class="fa-fw fa fa-briefcase"></i><span> 工具箱</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-book"></i><span> 找文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fa fa-address-card"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav></header><main class="layout" id="content-inner"><div id="post"><div id="post-info"><h1 class="post-title">Butterfly魔改系列🦋扩展功能和特效</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-12-02T16:00:00.000Z" title="发表于 2020-12-03 00:00:00">2020-12-03</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-04-24T14:32:19.954Z" title="更新于 2021-04-24 22:32:19">2021-04-24</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Hexo/">Hexo</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Hexo/%E4%B8%BB%E9%A2%98%E9%AD%94%E6%94%B9%E7%B3%BB%E5%88%97/">主题魔改系列</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">3.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>14分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Butterfly魔改系列🦋扩展功能和特效"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div><article class="post-content" id="article-container"><h1 id="扩展功能"><a href="#扩展功能" class="headerlink" title="扩展功能"></a>扩展功能</h1><h2 id="友情链接"><a href="#友情链接" class="headerlink" title="友情链接"></a>友情链接</h2><ul>
<li>打开<code>Basn</code>命令</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new page link</span><br></pre></td></tr></table></figure>

<ul>
<li>找到<code>C:\[rootblog]\source\link\index.md</code></li>
</ul>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: 友情链接</span><br><span class="line">date: 2020-06-03 17:53:02</span><br><span class="line">type: link</span><br><span class="line">---</span><br></pre></td></tr></table></figure>

<ul>
<li>在<code>C:\[rootblog]\source\ </code>目录下新建<code>_data </code>文件夹，文件夹内新建 <code>link.yml</code></li>
</ul>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="bullet">-</span> <span class="attr">class_name:</span> <span class="string">友情链接</span></span><br><span class="line">  <span class="attr">class_desc:</span> <span class="string">🤝🤝🤝</span></span><br><span class="line">  <span class="attr">link_list:</span></span><br><span class="line">    <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">小李博客</span></span><br><span class="line">      <span class="attr">link:</span> <span class="string">https://xiaoliblog.cn/</span></span><br><span class="line">      <span class="attr">avatar:</span> <span class="string">https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/1f52735f41052a8a163fbef9101b879e.png</span></span><br><span class="line">      <span class="attr">descr:</span> <span class="string">越努力越幸运</span></span><br></pre></td></tr></table></figure>

<h2 id="Categories-Magnet"><a href="#Categories-Magnet" class="headerlink" title="Categories Magnet"></a>Categories Magnet</h2><ul>
<li>首页分类磁贴效果如下</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@9fda9dfd0de61f6a049b9f8f08ee92c2dd151a8e/2021/04/23/1b8dc575bf4bf29f9f8660adc6ed5f3d.png"></p>
<ul>
<li>教程请参考Akilar大佬的基于 Butterfly 主题的分类磁贴：<a target="_blank" rel="noopener" href="https://akilar.top/posts/a9131002/">https://akilar.top/posts/a9131002/</a></li>
</ul>
<h2 id="Gitcalendar"><a href="#Gitcalendar" class="headerlink" title="Gitcalendar"></a>Gitcalendar</h2><ul>
<li>Gitcalendar效果如下</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@587d619e9f740f91d8f021234a4b44f8b30f019f/2021/04/23/35efe724abf6aeeb6e06a1379fe3d875.png"></p>
<ul>
<li>项目API地址：<a target="_blank" rel="noopener" href="https://github.com/Zfour/python_github_calendar_api">https://github.com/Zfour/python_github_calendar_api</a></li>
<li>教程请参考Akilar大佬的基于 Butterfly 主题的首页置顶 gitcalendar：<a target="_blank" rel="noopener" href="https://akilar.top/posts/1f9c68c9/">https://akilar.top/posts/1f9c68c9/</a></li>
</ul>
<h2 id="Friend-link-subscription"><a href="#Friend-link-subscription" class="headerlink" title="Friend link subscription"></a>Friend link subscription</h2><ul>
<li>项目地址：<a target="_blank" rel="noopener" href="https://github.com/Zfour/Butterfly-friend-poor-html">https://github.com/Zfour/Butterfly-friend-poor-html</a></li>
<li>教程请参考Akilar大佬的基于 Butterfly 主题的友链朋友圈前端配置方案：<a target="_blank" rel="noopener" href="https://akilar.top/posts/8480b91c/">https://akilar.top/posts/8480b91c/</a></li>
</ul>
<h2 id="Algolia搜索功能"><a href="#Algolia搜索功能" class="headerlink" title="Algolia搜索功能"></a>Algolia搜索功能</h2><h3 id="注册algolia"><a href="#注册algolia" class="headerlink" title="注册algolia"></a>注册algolia</h3><ul>
<li>项目地址：<a target="_blank" rel="noopener" href="https://github.com/oncletom/hexo-algolia">https://github.com/oncletom/hexo-algolia</a></li>
<li>前往<a target="_blank" rel="noopener" href="https://www.algolia.com/">Algolia</a>注册页面，注册一个新账户。可以使用GitHub或者Google账户直接登录，注册后的14天内拥有所有功能（包括收费类别的）。之后若未续费会自动降级为免费账户，免费账户总共有10,000条记录，每月有100,000的可以操作数</li>
<li>注册完成后，左侧侧边栏找到【Indices】创建一个新的<code>Index</code>，这个 <code>Index</code> 将在后面使用</li>
<li>左侧侧边栏找到API Keys，进入后点击【All API Keys】，然后【New API Key】</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@c0bbe44069de01735518f1d97ae2cf2bcb77979c/2021/04/24/0734e10e40d248de08e3e95b9352f3ec.png"></p>
<ul>
<li>填上index name，然在ACL里面增加删除和新增Object的权限，其他可以默认</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@f7ab47d2432e7fe209ce4375a1e5f781f6ccbb1c/2021/04/24/440b9e63f50ce6feeb57375f416c7e44.png" width="60%">

<ul>
<li>然后就有了一个API Key（马赛克部分），保存好</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@a01ca3366786ab4fc7c437ae0843884f83915443/2021/04/24/943b3a5617f96c674e3c415697df7153.png"></p>
<h3 id="安装algolia"><a href="#安装algolia" class="headerlink" title="安装algolia"></a>安装algolia</h3><ul>
<li>在Hexo根目录下执行</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-algolia --save</span><br></pre></td></tr></table></figure>

<ul>
<li>在Hexo根目录的<code>_config.yml</code>中加入algolia的配置，注意改成前面API Keys页面相应配置<ul>
<li>这里注意apikey填写刚才你创建的那个有权限的，其余的在your api keys里面可以找到</li>
</ul>
</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6c6aa35db765acda46caa59ecbd7d2fe8a17ae4a/2021/04/24/c8308c3b5d7d1d3844022aaecdd8442c.png"></p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">algolia:</span></span><br><span class="line">  <span class="attr">applicationID:</span> <span class="string">&#x27;your applicationID&#x27;</span></span><br><span class="line">  <span class="attr">apiKey:</span> <span class="string">&#x27;your apiKey&#x27;</span></span><br><span class="line">  <span class="attr">adminApiKey:</span> <span class="string">&#x27;your adminApiKey&#x27;</span></span><br><span class="line">  <span class="attr">indexName:</span> <span class="string">&#x27;your indexName&#x27;</span></span><br><span class="line">  <span class="attr">chunkSize:</span> <span class="number">5000</span></span><br></pre></td></tr></table></figure>

<ul>
<li>上传数据到algolia，下面your apiKey替换为刚才自己创建拥有权限的api</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">export HEXO_ALGOLIA_INDEXING_KEY=your apiKey</span><br><span class="line">hexo algolia</span><br></pre></td></tr></table></figure>

<ul>
<li>看到如下信息，证明成功了，可以去algolia网站上查看，索引已经上传成功了</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">INFO  [hexo-algolia] Testing HEXO_ALGOLIA_INDEXING_KEY permissions.</span><br><span class="line">INFO  Start processing</span><br><span class="line">INFO  [hexo-algolia] 218 records to index (post, page).</span><br><span class="line">INFO  [hexo-algolia] Indexing chunk 1 of 5 (50 records)</span><br><span class="line">INFO  [hexo-algolia] Indexing chunk 2 of 5 (50 records)</span><br><span class="line">INFO  [hexo-algolia] Indexing chunk 3 of 5 (50 records)</span><br><span class="line">INFO  [hexo-algolia] Indexing chunk 4 of 5 (50 records)</span><br><span class="line">INFO  [hexo-algolia] Indexing chunk 5 of 5 (18 records)</span><br><span class="line">INFO  [hexo-algolia] Indexing done.</span><br></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@c41441887d9f46ad6c3b354366dc5af17961152f/2021/04/24/c66e27c9c2bc75287040c293a57814ac.png"></p>
<h3 id="开启algolia"><a href="#开启algolia" class="headerlink" title="开启algolia"></a>开启algolia</h3><ul>
<li>进入主题的<code>_config.yml</code>配置文件，配置如下</li>
</ul>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">algolia_search:</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">hits:</span></span><br><span class="line">    <span class="attr">per_page:</span> <span class="number">10</span></span><br><span class="line">  <span class="attr">labels:</span></span><br><span class="line">    <span class="attr">input_placeholder:</span> <span class="string">Search</span> <span class="string">for</span> <span class="string">Posts</span></span><br><span class="line">    <span class="attr">hits_empty:</span> <span class="string">&quot;我们没有找到任何搜索结果: $&#123;query&#125;&quot;</span></span><br><span class="line">    <span class="attr">hits_stats:</span> <span class="string">&quot;找到$&#123;hits&#125;条结果（用时$&#123;time&#125; ms）&quot;</span></span><br></pre></td></tr></table></figure>

<h2 id="本地搜索"><a href="#本地搜索" class="headerlink" title="本地搜索"></a>本地搜索</h2><ul>
<li>由于Algolia每次增加文章都要重新提交一下如下代码：</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">export HEXO_ALGOLIA_INDEXING_KEY=your apiKey</span><br><span class="line">hexo algolia</span><br></pre></td></tr></table></figure>

<ul>
<li><p>觉得麻烦的话可以换本地搜索</p>
</li>
<li><p>把Algolia的根目录配置文件注释掉，主题配置文件改为<code>false</code>，并卸载掉插件</p>
</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm uninstall hexo-algolia</span><br></pre></td></tr></table></figure>

<ul>
<li>安装本地搜索插件</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-generator-searchdb --save</span><br></pre></td></tr></table></figure>

<ul>
<li>在站点根目录的配置文件组添加</li>
</ul>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">search:</span></span><br><span class="line">  <span class="attr">path:</span> <span class="string">search.xml</span></span><br><span class="line">  <span class="attr">field:</span> <span class="string">post</span></span><br><span class="line">  <span class="attr">format:</span> <span class="string">html</span></span><br><span class="line">  <span class="attr">limit:</span> <span class="number">10000</span></span><br></pre></td></tr></table></figure>

<ul>
<li>在主题配置文件<code>_config.yml</code>中启用：</li>
</ul>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Local search</span></span><br><span class="line"><span class="attr">local_search:</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">true</span> <span class="comment">#本地搜索</span></span><br></pre></td></tr></table></figure>

<ul>
<li>最后记得hexo三连，如果直接hexo g -d的话，搜索关键字不会变红</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo cl &amp; hexo g &amp; hexo d</span><br></pre></td></tr></table></figure>

<h1 id="扩展特效"><a href="#扩展特效" class="headerlink" title="扩展特效"></a>扩展特效</h1><h2 id="添加2D人物模型"><a href="#添加2D人物模型" class="headerlink" title="添加2D人物模型"></a>添加2D人物模型</h2><ul>
<li>在博客文件夹下右击,Git Bash</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --save hexo-helper-live2d</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install live2d-widget-model-hijiki(模型名)</span><br></pre></td></tr></table></figure>

<ul>
<li>参考<a target="_blank" rel="noopener" href="https://blog.csdn.net/wang_123_zy/article/details/87181892">模型名及样式</a></li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">在根目录配置文件中添加如下代码：</span><br><span class="line">live2d:</span><br><span class="line">  <span class="built_in">enable</span>: <span class="literal">true</span></span><br><span class="line">  scriptFrom: <span class="built_in">local</span></span><br><span class="line">  pluginRootPath: live2dw/</span><br><span class="line">  pluginJsPath: lib/</span><br><span class="line">  pluginModelPath: assets/</span><br><span class="line">  tagMode: <span class="literal">false</span></span><br><span class="line">  <span class="built_in">log</span>: <span class="literal">false</span></span><br><span class="line">  model:</span><br><span class="line">    use: live2d-widget-model-hijiki(模型名)</span><br><span class="line">  display:</span><br><span class="line">    position: right</span><br><span class="line">    width: 150</span><br><span class="line">    height: 300</span><br><span class="line">  mobile:</span><br><span class="line">    show: <span class="literal">true</span></span><br><span class="line">  react:</span><br><span class="line">    opacity: 0.7</span><br></pre></td></tr></table></figure>

<h2 id="新春灯笼特效"><a href="#新春灯笼特效" class="headerlink" title="新春灯笼特效"></a>新春灯笼特效</h2><ul>
<li>参考项目地址：<a target="_blank" rel="noopener" href="https://github.com/fz6m/china-lantern">https://github.com/fz6m/china-lantern</a></li>
<li>butterfly主题配置文件对应位置修改</li>
</ul>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">inject:</span></span><br><span class="line">  <span class="attr">head:</span></span><br><span class="line">  <span class="attr">bottom:</span></span><br><span class="line">    <span class="bullet">-</span> <span class="string">&lt;script</span> <span class="string">src=&quot;https://cdn.jsdelivr.net/gh/fz6m/china-lantern@1.6/dist/china-lantern.min.js&quot;&gt;&lt;/script&gt;</span></span><br></pre></td></tr></table></figure>

<ul>
<li>也可以通过<code>CSS</code>引入</li>
</ul>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br></pre></td><td class="code"><pre><span class="line">&lt;!<span class="selector-tag">DOCTYPE</span> <span class="selector-tag">html</span>&gt;</span><br><span class="line">&lt;html lang=&quot;en&quot;&gt;</span><br><span class="line">&lt;<span class="selector-tag">head</span>&gt;</span><br><span class="line">    &lt;meta charset=&quot;UTF-8&quot;&gt;</span><br><span class="line">    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;</span><br><span class="line">    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;</span><br><span class="line">    &lt;title&gt;Document&lt;/title&gt;</span><br><span class="line">&lt;/head&gt;</span><br><span class="line">&lt;<span class="selector-tag">body</span>&gt;</span><br><span class="line">    &lt;<span class="selector-tag">style</span>&gt;</span><br><span class="line">        <span class="keyword">@media</span> <span class="keyword">only</span> screen <span class="keyword">and</span> (<span class="attribute">max-width:</span> <span class="number">760px</span>) &#123;</span><br><span class="line">          <span class="selector-class">.deng-box</span>,</span><br><span class="line">          <span class="selector-class">.deng-box1</span> &#123;</span><br><span class="line">            <span class="attribute">display</span>: none;</span><br><span class="line">          &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">@media</span> <span class="keyword">only</span> screen <span class="keyword">and</span> (<span class="attribute">min-width:</span> <span class="number">768px</span>) <span class="keyword">and</span> (<span class="attribute">max-width:</span> <span class="number">1024px</span>) &#123;</span><br><span class="line">          <span class="selector-class">.right</span> &#123;</span><br><span class="line">            <span class="attribute">float</span>: left <span class="meta">!important</span>;</span><br><span class="line">          &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng-box</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: fixed;</span><br><span class="line">          <span class="attribute">top</span>: <span class="number">20px</span>;</span><br><span class="line">          <span class="attribute">left</span>: <span class="number">10px</span>;</span><br><span class="line">          <span class="attribute">z-index</span>: <span class="number">99</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng-box1</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: fixed;</span><br><span class="line">          <span class="attribute">top</span>: <span class="number">20px</span>;</span><br><span class="line">          <span class="attribute">right</span>: <span class="number">10px</span>;</span><br><span class="line">          <span class="attribute">z-index</span>: <span class="number">99</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng-box1</span> <span class="selector-class">.deng</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: relative;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">120px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">90px</span>;</span><br><span class="line">          <span class="attribute">margin</span>: <span class="number">50px</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#d8000f</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="built_in">rgba</span>(<span class="number">216</span>, <span class="number">0</span>, <span class="number">15</span>, <span class="number">0.8</span>);</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">50%</span> <span class="number">50%</span>;</span><br><span class="line">          <span class="attribute">-webkit-transform-origin</span>: <span class="number">50%</span> -<span class="number">100px</span>;</span><br><span class="line">          <span class="attribute">-webkit-animation</span>: swing <span class="number">5s</span> infinite ease-in-out;</span><br><span class="line">          <span class="attribute">box-shadow</span>: -<span class="number">5px</span> <span class="number">5px</span> <span class="number">30px</span> <span class="number">4px</span> <span class="built_in">rgba</span>(<span class="number">252</span>, <span class="number">144</span>, <span class="number">61</span>, <span class="number">1</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: relative;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">120px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">90px</span>;</span><br><span class="line">          <span class="attribute">margin</span>: <span class="number">50px</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#d8000f</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="built_in">rgba</span>(<span class="number">216</span>, <span class="number">0</span>, <span class="number">15</span>, <span class="number">0.8</span>);</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">50%</span> <span class="number">50%</span>;</span><br><span class="line">          <span class="attribute">-webkit-transform-origin</span>: <span class="number">50%</span> -<span class="number">100px</span>;</span><br><span class="line">          <span class="attribute">-webkit-animation</span>: swing <span class="number">3s</span> infinite ease-in-out;</span><br><span class="line">          <span class="attribute">box-shadow</span>: -<span class="number">5px</span> <span class="number">5px</span> <span class="number">50px</span> <span class="number">4px</span> <span class="built_in">rgba</span>(<span class="number">250</span>, <span class="number">108</span>, <span class="number">0</span>, <span class="number">1</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng-a</span> &#123;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">100px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">90px</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#d8000f</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="built_in">rgba</span>(<span class="number">216</span>, <span class="number">0</span>, <span class="number">15</span>, <span class="number">0.1</span>);</span><br><span class="line">          <span class="attribute">margin</span>: <span class="number">12px</span> <span class="number">8px</span> <span class="number">8px</span> <span class="number">10px</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">50%</span> <span class="number">50%</span>;</span><br><span class="line">          <span class="attribute">border</span>: <span class="number">2px</span> solid <span class="number">#dc8f03</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng-b</span> &#123;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">45px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">90px</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#d8000f</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="built_in">rgba</span>(<span class="number">216</span>, <span class="number">0</span>, <span class="number">15</span>, <span class="number">0.1</span>);</span><br><span class="line">          <span class="attribute">margin</span>: -<span class="number">4px</span> <span class="number">8px</span> <span class="number">8px</span> <span class="number">26px</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">50%</span> <span class="number">50%</span>;</span><br><span class="line">          <span class="attribute">border</span>: <span class="number">2px</span> solid <span class="number">#dc8f03</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.xian</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: absolute;</span><br><span class="line">          <span class="attribute">top</span>: -<span class="number">20px</span>;</span><br><span class="line">          <span class="attribute">left</span>: <span class="number">60px</span>;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">2px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">20px</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#dc8f03</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.shui-a</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: relative;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">5px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">20px</span>;</span><br><span class="line">          <span class="attribute">margin</span>: -<span class="number">5px</span> <span class="number">0</span> <span class="number">0</span> <span class="number">59px</span>;</span><br><span class="line">          <span class="attribute">-webkit-animation</span>: swing <span class="number">4s</span> infinite ease-in-out;</span><br><span class="line">          <span class="attribute">-webkit-transform-origin</span>: <span class="number">50%</span> -<span class="number">45px</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#ffa500</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">0</span> <span class="number">0</span> <span class="number">5px</span> <span class="number">5px</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.shui-b</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: absolute;</span><br><span class="line">          <span class="attribute">top</span>: <span class="number">14px</span>;</span><br><span class="line">          <span class="attribute">left</span>: -<span class="number">2px</span>;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">10px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">10px</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#dc8f03</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">50%</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.shui-c</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: absolute;</span><br><span class="line">          <span class="attribute">top</span>: <span class="number">18px</span>;</span><br><span class="line">          <span class="attribute">left</span>: -<span class="number">2px</span>;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">10px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">35px</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#ffa500</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">0</span> <span class="number">0</span> <span class="number">0</span> <span class="number">5px</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: absolute;</span><br><span class="line">          <span class="attribute">top</span>: -<span class="number">7px</span>;</span><br><span class="line">          <span class="attribute">left</span>: <span class="number">29px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">12px</span>;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">60px</span>;</span><br><span class="line">          <span class="attribute">content</span>: <span class="string">&quot; &quot;</span>;</span><br><span class="line">          <span class="attribute">display</span>: block;</span><br><span class="line">          <span class="attribute">z-index</span>: <span class="number">999</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">5px</span> <span class="number">5px</span> <span class="number">0</span> <span class="number">0</span>;</span><br><span class="line">          <span class="attribute">border</span>: solid <span class="number">1px</span> <span class="number">#dc8f03</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#ffa500</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="built_in">linear-gradient</span>(</span><br><span class="line">            to right,</span><br><span class="line">            #dc8f03,</span><br><span class="line">            #ffa500,</span><br><span class="line">            #dc8f03,</span><br><span class="line">            #ffa500,</span><br><span class="line">            #dc8f03</span><br><span class="line">          );</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng</span><span class="selector-pseudo">:after</span> &#123;</span><br><span class="line">          <span class="attribute">position</span>: absolute;</span><br><span class="line">          <span class="attribute">bottom</span>: -<span class="number">7px</span>;</span><br><span class="line">          <span class="attribute">left</span>: <span class="number">10px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">12px</span>;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">60px</span>;</span><br><span class="line">          <span class="attribute">content</span>: <span class="string">&quot; &quot;</span>;</span><br><span class="line">          <span class="attribute">display</span>: block;</span><br><span class="line">          <span class="attribute">margin-left</span>: <span class="number">20px</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">0</span> <span class="number">0</span> <span class="number">5px</span> <span class="number">5px</span>;</span><br><span class="line">          <span class="attribute">border</span>: solid <span class="number">1px</span> <span class="number">#dc8f03</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="number">#ffa500</span>;</span><br><span class="line">          <span class="attribute">background</span>: <span class="built_in">linear-gradient</span>(</span><br><span class="line">            to right,</span><br><span class="line">            #dc8f03,</span><br><span class="line">            #ffa500,</span><br><span class="line">            #dc8f03,</span><br><span class="line">            #ffa500,</span><br><span class="line">            #dc8f03</span><br><span class="line">          );</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.deng-t</span> &#123;</span><br><span class="line">          <span class="attribute">font-family</span>: 华文行楷;</span><br><span class="line">          <span class="attribute">font-size</span>: <span class="number">26px</span>;</span><br><span class="line">          <span class="attribute">color</span>: <span class="number">#dc8f03</span>;</span><br><span class="line">          <span class="attribute">font-weight</span>: bold;</span><br><span class="line">          <span class="attribute">line-height</span>: <span class="number">44px</span>;</span><br><span class="line">          <span class="attribute">text-align</span>: center;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.night</span> <span class="selector-class">.deng-t</span>,</span><br><span class="line">        <span class="selector-class">.night</span> <span class="selector-class">.deng-box</span>,</span><br><span class="line">        <span class="selector-class">.night</span> <span class="selector-class">.deng-box1</span> &#123;</span><br><span class="line">          <span class="attribute">background</span>: transparent <span class="meta">!important</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">@-moz-keyframes</span> swing &#123;</span><br><span class="line">          0% &#123;</span><br><span class="line">            <span class="attribute">-moz-transform</span>: <span class="built_in">rotate</span>(-<span class="number">10deg</span>);</span><br><span class="line">          &#125;</span><br><span class="line">          50% &#123;</span><br><span class="line">            <span class="attribute">-moz-transform</span>: <span class="built_in">rotate</span>(<span class="number">10deg</span>);</span><br><span class="line">          &#125;</span><br><span class="line">          100% &#123;</span><br><span class="line">            <span class="attribute">-moz-transform</span>: <span class="built_in">rotate</span>(-<span class="number">10deg</span>);</span><br><span class="line">          &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">@-webkit-keyframes</span> swing &#123;</span><br><span class="line">          0% &#123;</span><br><span class="line">            <span class="attribute">-webkit-transform</span>: <span class="built_in">rotate</span>(-<span class="number">10deg</span>);</span><br><span class="line">          &#125;</span><br><span class="line">          50% &#123;</span><br><span class="line">            <span class="attribute">-webkit-transform</span>: <span class="built_in">rotate</span>(<span class="number">10deg</span>);</span><br><span class="line">          &#125;</span><br><span class="line">          100% &#123;</span><br><span class="line">            <span class="attribute">-webkit-transform</span>: <span class="built_in">rotate</span>(-<span class="number">10deg</span>);</span><br><span class="line">          &#125;</span><br><span class="line">        &#125;</span><br><span class="line">      &lt;/style&gt;</span><br><span class="line">      &lt;div class=&quot;deng-box&quot;&gt;</span><br><span class="line">        &lt;div class=&quot;deng&quot;&gt;</span><br><span class="line">          &lt;div class=&quot;xian&quot;&gt;&lt;/div&gt;</span><br><span class="line">          &lt;div class=&quot;deng-a&quot;&gt;</span><br><span class="line">            &lt;div class=&quot;deng-b&quot;&gt;&lt;div class=&quot;deng-t&quot;&gt;喜迎&lt;/div&gt;&lt;/div&gt;</span><br><span class="line">          &lt;/div&gt;</span><br><span class="line">          &lt;div class=&quot;shui shui-a&quot;&gt;</span><br><span class="line">            &lt;div class=&quot;shui-c&quot;&gt;&lt;/div&gt;</span><br><span class="line">            &lt;div class=&quot;shui-b&quot;&gt;&lt;/div&gt;</span><br><span class="line">          &lt;/div&gt;</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">      &lt;/div&gt;</span><br><span class="line">      &lt;div class=&quot;deng-box1&quot;&gt;</span><br><span class="line">        &lt;div class=&quot;deng&quot;&gt;</span><br><span class="line">          &lt;div class=&quot;xian&quot;&gt;&lt;/div&gt;</span><br><span class="line">          &lt;div class=&quot;deng-a&quot;&gt;</span><br><span class="line">            &lt;div class=&quot;deng-b&quot;&gt;&lt;div class=&quot;deng-t&quot;&gt;新春&lt;/div&gt;&lt;/div&gt;</span><br><span class="line">          &lt;/div&gt;</span><br><span class="line">          &lt;div class=&quot;shui shui-a&quot;&gt;</span><br><span class="line">            &lt;div class=&quot;shui-c&quot;&gt;&lt;/div&gt;</span><br><span class="line">            &lt;div class=&quot;shui-b&quot;&gt;&lt;/div&gt;</span><br><span class="line">          &lt;/div&gt;</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">      &lt;/div&gt;</span><br><span class="line">&lt;/body&gt;</span><br><span class="line">&lt;/html&gt;</span><br></pre></td></tr></table></figure>
<h2 id="雪花飘落特效"><a href="#雪花飘落特效" class="headerlink" title="雪花飘落特效"></a>雪花飘落特效</h2><ul>
<li>butterlfy主题配置文件相应位置修改</li>
</ul>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">inject:</span></span><br><span class="line">  <span class="attr">head:</span></span><br><span class="line">  <span class="attr">bottom:</span></span><br><span class="line">    <span class="bullet">-</span> <span class="string">&lt;div&gt;&lt;canvas</span> <span class="string">id=&quot;snow&quot;</span> <span class="string">style=&quot;position:fixed;top:0;left:0;width:100%;height:100%;z-index:99999;pointer-events:none&quot;&gt;&lt;/canvas&gt;&lt;/div&gt;</span></span><br><span class="line">    <span class="bullet">-</span> <span class="string">&lt;script&gt;const</span> <span class="string">notMobile</span> <span class="string">=</span> <span class="string">(!(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows</span> <span class="string">Phone)/i)));&lt;/script&gt;</span></span><br><span class="line">    <span class="bullet">-</span> <span class="string">&lt;script</span> <span class="string">async</span> <span class="string">type=&quot;text/javascript&quot;</span> <span class="string">src=&quot;https://cdn.jsdelivr.net/gh/Candinya/Kratos-Rebirth@latest/source/js/snow.min.js&quot;&gt;&lt;/script&gt;</span></span><br></pre></td></tr></table></figure>


<h1 id="自定义404页面"><a href="#自定义404页面" class="headerlink" title="自定义404页面"></a>自定义404页面</h1><ul>
<li>无论是GitHub还是Vercel自带的404页面，个人都不是很满意，所以可以自定义404页面</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> hexo new page <span class="string">&quot;404&quot;</span></span></span><br></pre></td></tr></table></figure>

<ul>
<li>在Hexo博客<code>source</code>目录下生成一个<code>404</code>文件夹，其中有一个<code>index.md</code>文件，这个文件其实就相当于是<code>404.html</code>了</li>
<li>打开<code>index.md</code>，修改头部信息。注意不要忘了修改<code>permalink</code>，不然不会在根目录下生成<code>404.html</code></li>
</ul>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">layout: false</span><br><span class="line">comments: false</span><br><span class="line">title: 404</span><br><span class="line">permalink: /404</span><br></pre></td></tr></table></figure>

<ul>
<li>由于markdown是支持插入html内容的，因此只需要在这个<code>md</code>文件里写入html代码即可。<strong>要注意的是html代码之间千万不能有空行，不然会标签识别错误!</strong></li>
<li>自定义404页面可以去<a target="_blank" rel="noopener" href="https://404.life/">404模板</a>查找，js和css可以放到刚才生成的404目录下</li>
<li>然后<code>hexo g</code>和<code>hexo d</code>部署即可</li>
</ul>
<h1 id="自定义独立页面"><a href="#自定义独立页面" class="headerlink" title="自定义独立页面"></a>自定义独立页面</h1><ul>
<li>Hexo 是一个轻量、快速，简单和强大的博客框架，当我们需要发布博文的时候，只需要将写好的文章（MarkDown文件）放入本地的<code> \source\_posts</code> 文件夹，然后再推送上去就行了，原理就是当我们在执行 <code>hexo g</code> 命令时，<code>.md</code> 文件就会被转化成 <code>HTML</code> 文件，但是有时候我们需要新建一个独立的页面，这个页面不使用主题的渲染，具有自己独立的样式，有两种方法实现</li>
</ul>
<h2 id="skip-render"><a href="#skip-render" class="headerlink" title="skip_render"></a>skip_render</h2><ul>
<li>使用 Hexo 提供的跳过渲染配置，在博客根目录的配置文件<code> _config.yml</code> 里找到 <code>skip_render</code> 关键字，在后面添加想要跳过渲染的页面</li>
<li>比如我们创建 <code>\source\about\index.html</code>, 配置文件填写:<code>skip_render: about\*\*</code>，那么就表示 <code>\source\about </code>里所有的文件将跳过渲染，里面的文件将会被直接复制到 public 文件夹，此时就会得到一个独立的 about 页面；官方文档：<a target="_blank" rel="noopener" href="https://hexo.io/docs/configuration">https://hexo.io/docs/configuration</a></li>
</ul>
<h2 id="layout-false"><a href="#layout-false" class="headerlink" title="layout: false"></a>layout: false</h2><ul>
<li>还可以通过在文章头部的<code>Front-matter</code>里添加配置 <code>layout: false </code>来跳过渲染配置</li>
<li>比如我们要使 about 页面跳过渲染，创建<code> \source\about\index.md</code>，将这个页面的相关 HTML 代码写进<code>.md</code>文件并保存，然后在 <code>index.md </code>的头部写入：</li>
</ul>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">layout: false</span><br><span class="line">---</span><br><span class="line"></span><br><span class="line">&#123;% raw %&#125;</span><br><span class="line">xxxxxxxxxxxxx</span><br><span class="line">xx HTML代码 xx</span><br><span class="line">xxxxxxxxxxxxx</span><br><span class="line">&#123;% endraw %&#125;</span><br></pre></td></tr></table></figure>


<ul>
<li><p>Front-matter 是 <code>.md</code> 文件最上方以 — 分隔的区域，用于指定个别文件的变量，官方文档：<a target="_blank" rel="noopener" href="https://hexo.io/docs/front-matter">https://hexo.io/docs/front-matter</a></p>
</li>
<li><p><code>.md</code>文件中的 HTML 代码要用 <code>` 和 `</code> 包起来，使其能正确编译里面的代码</p>
</li>
</ul>
<h1 id="Hexo访问URL全英文"><a href="#Hexo访问URL全英文" class="headerlink" title="Hexo访问URL全英文"></a>Hexo访问URL全英文</h1><ul>
<li>在使用Hexo框架生成静态博客时，其实是将你写好的.md文件输出成HTML文件进行渲染，其中HTML的文件名称就是.md的文件名称</li>
<li>例如：Java学习笔记.md经过hexo g命令会生成Java学习笔记.html；执行hexo d命令会将文件推送到你的仓库，那么你访问这篇章时，对应的地址栏就是<a target="_blank" rel="noopener" href="http://xxxx/.../Java%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0.html">http://xxxx/.../Java学习笔记.html</a> ，这样看起来很别扭，对搜索引擎也不友好</li>
<li>于是有两种解决方法<ul>
<li>一种是增加文章ID，可以自动生成一串字符，但不会现实HTML后缀</li>
<li>另一种是修改文件生成规则，需要为每一篇文章定义一个唯一的名称</li>
</ul>
</li>
</ul>
<h2 id="增加文章ID"><a href="#增加文章ID" class="headerlink" title="增加文章ID"></a>增加文章ID</h2><ul>
<li><p>具体可以参考Hexo官方文档中<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/permalinks.html">永久链接（Permalinks） | Hexo</a>这一篇文章<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@4ee9fb94fb6d9e4897a27df3b1d06a6f74e40538/2021/02/06/b0988d3e602bc06d81e09645faa53c4a.png"></p>
</li>
<li><p>在博客根目录的配置文件<code>_congif.yml</code>中修改<code>permalink</code>变量</p>
</li>
</ul>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#permalink: :year/:month/:day/:title # 这是原配置</span></span><br><span class="line"><span class="attr">permalink:</span> <span class="string">:year/:id/</span> <span class="comment"># 替换为此新配置</span></span><br></pre></td></tr></table></figure>

<ul>
<li>可以自定义名称，在<code>.\scaffolds\post.md</code>中修改为：</li>
</ul>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: &#123;&#123; title &#125;&#125;</span><br><span class="line">id: </span><br><span class="line">date: &#123;&#123; date &#125;&#125;</span><br><span class="line">updated: &#123;&#123; date &#125;&#125;</span><br><span class="line">categories:</span><br><span class="line">tags:</span><br><span class="line">permalink: </span><br><span class="line">---</span><br></pre></td></tr></table></figure>

<ul>
<li>在我们的具体文章中，你可以使用<strong>任意数字和字母</strong>作为此文章的id，但最好有规律的命名，不用包含特殊字符，推荐使用创建日期中的<code>月+日+时+分+秒</code>来定义一个id</li>
</ul>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: &#123;&#123; title &#125;&#125;</span><br><span class="line">permalink: 02062017</span><br><span class="line">---</span><br></pre></td></tr></table></figure>
<h2 id="改文件生成规则"><a href="#改文件生成规则" class="headerlink" title="改文件生成规则"></a>改文件生成规则</h2><ul>
<li>在博客根目录的配置文件<code>_congif.yml</code>中修改<code>permalink</code>变量</li>
</ul>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#permalink: :year/:month/:day/:title # 这是原配置</span></span><br><span class="line"><span class="attr">permalink:</span> <span class="string">page/:fileName.html</span> <span class="comment"># 替换为此新配置</span></span><br></pre></td></tr></table></figure>

<ul>
<li><code>page</code>是目录，执行<code>hexo g</code>会在<code>public</code>下生成，我让生成的HTML文件都放在page下，<code>:fileName.html</code>是HTML的命名格式，其中fileName是个变量，变量值来自于.md文件的设置，每篇文章只要头部加了这个属性，并赋值且确保唯一就OK了</li>
</ul>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: 计算机网络🌈数据链路层</span><br><span class="line">subtitle: </span><br><span class="line">sticky: </span><br><span class="line">fileName: h3s09b</span><br><span class="line">tags:  计算机网络</span><br><span class="line">categories:  </span><br></pre></td></tr></table></figure>

<ul>
<li>为了避免忘记在写文章时写fileName属性，我们可以修改模板，在<code>scaffolds</code>目录下有三个模板，修改其中的<code>post.md</code></li>
</ul>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: &#123;&#123; title &#125;&#125;</span><br><span class="line">date: &#123;&#123; date &#125;&#125;</span><br><span class="line">tags:</span><br><span class="line">categories:</span><br><span class="line">fileName: 千万别忘写，必须要唯一！</span><br><span class="line">---</span><br></pre></td></tr></table></figure>

<ul>
<li>命名规范可以自己定义，比如今天是五月m，日期29，周三w，时间是17点，文件名就可以就是<code>m29w17</code></li>
</ul>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">小李博客</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://xiaoliblog.cn">https://xiaoliblog.cn</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://xiaoliblog.cn" target="_blank">小李博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Hexo/">Hexo</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2b4802e64dda1cdfead2db084a07b179beaff7dc/2021/03/29/082954b9ca0f481522271eaecce8d840.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button button--animated"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/img/wechat.png" target="_blank"><img class="post-qr-code-img" src="/img/wechat.png" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/img/alipay.png" target="_blank"><img class="post-qr-code-img" src="/img/alipay.png" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/page/Hexo01.html"><img class="prev-cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2b4802e64dda1cdfead2db084a07b179beaff7dc/2021/03/29/082954b9ca0f481522271eaecce8d840.png" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Hexo博客访问速度优化</div></div></a></div><div class="next-post pull-right"><a href="/page/butterfly04.html"><img class="next-cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2b4802e64dda1cdfead2db084a07b179beaff7dc/2021/03/29/082954b9ca0f481522271eaecce8d840.png" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Butterfly魔改系列🦋扩展标签外挂</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/page/hexoblog.html" title="Hexo+GitHub搭建个人博客"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@88d6104165d7beac0f2c2844a539c0feffa4f33d/2021/01/24/993832d0c82e0ea4f5f7d61fb74320a6.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-11-14</div><div class="title">Hexo+GitHub搭建个人博客</div></div></a></div><div><a href="/page/domainname.html" title="绑定域名及备案"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@1289385bb15c8ef0149662f57371d72126bfb35e/2021/01/24/ccb235313f0b17b70c743893c77b8f00.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-14</div><div class="title">绑定域名及备案</div></div></a></div><div><a href="/page/comments.html" title="Twikoo+腾讯云评论配置"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2b4802e64dda1cdfead2db084a07b179beaff7dc/2021/03/29/082954b9ca0f481522271eaecce8d840.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-14</div><div class="title">Twikoo+腾讯云评论配置</div></div></a></div><div><a href="/page/hexo03.html" title="Hexo博客结构及配置文件解析"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2b4802e64dda1cdfead2db084a07b179beaff7dc/2021/03/29/082954b9ca0f481522271eaecce8d840.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-12-04</div><div class="title">Hexo博客结构及配置文件解析</div></div></a></div><div><a href="/page/hexobackup.html" title="hexo-git-backup 博客备份及恢复"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@8df57ff10940cc28f2a002a9407e0833ad71ea64/2021/01/26/5826e1ab4aad3f7ac919f549b3919efe.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-26</div><div class="title">hexo-git-backup 博客备份及恢复</div></div></a></div><div><a href="/page/butterfly01.html" title="Butterfly魔改系列🦋基础视觉美化"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2b4802e64dda1cdfead2db084a07b179beaff7dc/2021/03/29/082954b9ca0f481522271eaecce8d840.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-12-02</div><div class="title">Butterfly魔改系列🦋基础视觉美化</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6b5e7ef72be1c8973d94e5a9c49accbf775ad820/2021/02/01/c485da031fe0e464d04eaba8a66c4a8f.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">小李博客</div><div class="author-info__description">越努力，越幸运！</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">210</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">38</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">56</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xiaoliblog"><i class="fab fa-github"></i><span>博主的GitHub首页</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/xiaoliblog" target="_blank" title="Gitee"><i class="iconfont icon-gitee card_icon_gitee"></i></a><a class="social-icon" href="https://space.bilibili.com/390969485" target="_blank" title="BiliBili"><i class="iconfont icon-bilibili card_icon_bilibili"></i></a><a class="social-icon" href="http://wpa.qq.com/msgrd?v=3&amp;uin=2312057536&amp;site=CSDN&amp;menu=yes" target="_blank" title="QQ"><i class="iconfont icon-qq card_icon_qq"></i></a><a class="social-icon" href="https://github.com/xiaoliblog" target="_blank" title="GitHub"><i class="iconfont icon-git card_icon_git"></i></a><a class="social-icon" href="https://blog.csdn.net/qq_43266250?spm=1010.2135.3001.5113" target="_blank" title="CSDN"><i class="iconfont icon-csdn card_icon_csdn"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">正在考研备考中💦</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%89%A9%E5%B1%95%E5%8A%9F%E8%83%BD"><span class="toc-number">1.</span> <span class="toc-text">扩展功能</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%8B%E6%83%85%E9%93%BE%E6%8E%A5"><span class="toc-number">1.1.</span> <span class="toc-text">友情链接</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Categories-Magnet"><span class="toc-number">1.2.</span> <span class="toc-text">Categories Magnet</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Gitcalendar"><span class="toc-number">1.3.</span> <span class="toc-text">Gitcalendar</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Friend-link-subscription"><span class="toc-number">1.4.</span> <span class="toc-text">Friend link subscription</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Algolia%E6%90%9C%E7%B4%A2%E5%8A%9F%E8%83%BD"><span class="toc-number">1.5.</span> <span class="toc-text">Algolia搜索功能</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B3%A8%E5%86%8Calgolia"><span class="toc-number">1.5.1.</span> <span class="toc-text">注册algolia</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85algolia"><span class="toc-number">1.5.2.</span> <span class="toc-text">安装algolia</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BC%80%E5%90%AFalgolia"><span class="toc-number">1.5.3.</span> <span class="toc-text">开启algolia</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9C%AC%E5%9C%B0%E6%90%9C%E7%B4%A2"><span class="toc-number">1.6.</span> <span class="toc-text">本地搜索</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%89%A9%E5%B1%95%E7%89%B9%E6%95%88"><span class="toc-number">2.</span> <span class="toc-text">扩展特效</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A02D%E4%BA%BA%E7%89%A9%E6%A8%A1%E5%9E%8B"><span class="toc-number">2.1.</span> <span class="toc-text">添加2D人物模型</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%B0%E6%98%A5%E7%81%AF%E7%AC%BC%E7%89%B9%E6%95%88"><span class="toc-number">2.2.</span> <span class="toc-text">新春灯笼特效</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%9B%AA%E8%8A%B1%E9%A3%98%E8%90%BD%E7%89%B9%E6%95%88"><span class="toc-number">2.3.</span> <span class="toc-text">雪花飘落特效</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%87%AA%E5%AE%9A%E4%B9%89404%E9%A1%B5%E9%9D%A2"><span class="toc-number">3.</span> <span class="toc-text">自定义404页面</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%87%AA%E5%AE%9A%E4%B9%89%E7%8B%AC%E7%AB%8B%E9%A1%B5%E9%9D%A2"><span class="toc-number">4.</span> <span class="toc-text">自定义独立页面</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#skip-render"><span class="toc-number">4.1.</span> <span class="toc-text">skip_render</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#layout-false"><span class="toc-number">4.2.</span> <span class="toc-text">layout: false</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Hexo%E8%AE%BF%E9%97%AEURL%E5%85%A8%E8%8B%B1%E6%96%87"><span class="toc-number">5.</span> <span class="toc-text">Hexo访问URL全英文</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A2%9E%E5%8A%A0%E6%96%87%E7%AB%A0ID"><span class="toc-number">5.1.</span> <span class="toc-text">增加文章ID</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%94%B9%E6%96%87%E4%BB%B6%E7%94%9F%E6%88%90%E8%A7%84%E5%88%99"><span class="toc-number">5.2.</span> <span class="toc-text">改文件生成规则</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/page/project01.html" title="前端实例🥳响应式网站首页"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@c19917500ab083c77c7613263ba7ee74d5a08ae6/2021/04/30/469f30b141d73fa0fc4c962662d5813f.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="前端实例🥳响应式网站首页"/></a><div class="content"><a class="title" href="/page/project01.html" title="前端实例🥳响应式网站首页">前端实例🥳响应式网站首页</a><time datetime="2021-04-30T11:50:53.094Z" title="发表于 2021-04-30 19:50:53">2021-04-30</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/page/WeChatpay.html" title="微信支付对接"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@f2f670b92ea149650ffa7834354fc90284f2f44a/2021/04/29/5bdc9b381a06193d27cf2fb7c2fb608a.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="微信支付对接"/></a><div class="content"><a class="title" href="/page/WeChatpay.html" title="微信支付对接">微信支付对接</a><time datetime="2021-04-29T12:20:48.070Z" title="发表于 2021-04-29 20:20:48">2021-04-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/page/Alipay.html" title="支付宝支付对接"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@61a9b6a6e09e4bda38bb08e3104b717885beaee5/2021/04/29/c3fa51f9cf14e90d9e5a7aa8814dd041.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="支付宝支付对接"/></a><div class="content"><a class="title" href="/page/Alipay.html" title="支付宝支付对接">支付宝支付对接</a><time datetime="2021-04-27T16:00:00.000Z" title="发表于 2021-04-28 00:00:00">2021-04-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/page/Vuejs11.html" title="Vue.js前端框架🎯Pagination+PageHelper实现分页"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@61bf4245f6d84d2d0f66d163b89c916788cc1845/2021/04/13/ec6b232f8fe5a840e4bd8c3eabcf49b2.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="Vue.js前端框架🎯Pagination+PageHelper实现分页"/></a><div class="content"><a class="title" href="/page/Vuejs11.html" title="Vue.js前端框架🎯Pagination+PageHelper实现分页">Vue.js前端框架🎯Pagination+PageHelper实现分页</a><time datetime="2021-04-26T14:48:39.701Z" title="发表于 2021-04-26 22:48:39">2021-04-26</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/page/Vuejs10.html" title="Vue.js前端框架🎯Vue-Element-admin模版"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@61bf4245f6d84d2d0f66d163b89c916788cc1845/2021/04/13/ec6b232f8fe5a840e4bd8c3eabcf49b2.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="Vue.js前端框架🎯Vue-Element-admin模版"/></a><div class="content"><a class="title" href="/page/Vuejs10.html" title="Vue.js前端框架🎯Vue-Element-admin模版">Vue.js前端框架🎯Vue-Element-admin模版</a><time datetime="2021-04-19T16:00:00.000Z" title="发表于 2021-04-20 00:00:00">2021-04-20</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 小李博客</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">🎯Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">🎉Butterfly</a></div><div class="footer_custom_text"><span><a style="margin-inline:5px" target="_blank" href="https://hexo.io/"><img src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&logo=hexo" title="博客框架为Hexo"></a><a style="margin-inline:5px" target="_blank" href="https://butterfly.js.org/"><img src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&logo=bitdefender" title="主题采用butterfly"></a><a style="margin-inline:5px" target="_blank" href="https://www.jsdelivr.com/"><img src="https://img.shields.io/badge/CDN-jsDelivr-orange?style=flat&logo=jsDelivr" title="本站使用JsDelivr为静态资源提供CDN加速"></a><a style="margin-inline:5px" target="_blank" href="https://vercel.com/ "><img src="https://img.shields.io/badge/Hosted-Vercel-brightgreen?style=flat&logo=Vercel" title="本站采用双线部署，默认线路托管于Vercel"></a><a style="margin-inline:5px" target="_blank" href="https://coding.net/ "><img src="https://img.shields.io/badge/Hosted-Coding-0cedbe?style=flat&logo=Codio" title="本站采用双线部署，联通线路托管于Coding"></a><a style="margin-inline:5px" target="_blank" href="https://github.com/"><img src="https://img.shields.io/badge/Source-Github-d021d6?style=flat&logo=GitHub" title="本站项目由Gtihub托管"></a><a style="margin-inline:5px" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&logo=Claris" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a></span></div><div class="icp"><a target="_blank" rel="noopener" href="https://beian.miit.gov.cn/"><img class="icp-icon" src="/img/icp.png" alt="ICP"/><span>湘ICP备2021002541号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="font-plus" type="button" title="放大字体"><i class="fas fa-plus"></i></button><button id="font-minus" type="button" title="缩小字体"><i class="fas fa-minus"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="chat_btn" type="button" title="rightside.chat_btn"><i class="fas fa-sms"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="algolia-search"><div class="search-dialog"><div class="search-dialog__title" id="algolia-search-title">Algolia</div><div id="algolia-input-panel"><div id="algolia-search-input"></div></div><hr/><div id="algolia-search-results"><div id="algolia-hits"></div><div id="algolia-pagination"></div><div id="algolia-stats"></div></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script><script src="/js/main.js"></script><script defer src="/js/tw_cn.js"></script><script defer src="https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module" defer></script><script defer src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script defer src="/js/search/algolia.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    loader: {
      source: {
        '[tex]/amsCd': '[tex]/amscd'
      }
    },
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        addClass: [200,() => {
          document.querySelectorAll('mjx-container:not([display=\'true\']').forEach( node => {
            const target = node.parentNode
            if (!target.classList.contains('has-jax')) {
              target.classList.add('mathjax-overflow')
            }
          })
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><script>if (document.getElementsByClassName('mermaid').length) {
  if (window.mermaidJsLoad) mermaid.init()
  else {
    getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(() => {
      window.mermaidJsLoad = true
      mermaid.initialize({
        theme: 'default',
      })
      false && mermaid.init()
    })
  }
}</script><script>(()=>{
  const $countDom = document.getElementById('twikoo-count')
  const init = () => {
    twikoo.init(Object.assign({
      el: '#twikoo-wrap',
      envId: 'xiaoliblog-8gj3j5045d5b0896',
      region: ''
    }, null))
  }

  const getCount = () => {
    twikoo.getCommentsCount({
      envId: 'xiaoliblog-8gj3j5045d5b0896',
      region: '',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      $countDom.innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const loadTwikoo = (bool = false) => {
    if (typeof twikoo === 'object') {
      init()
      bool && $countDom && setTimeout(getCount,0)
    } else {
      getScript('https://cdn.jsdelivr.net/npm/twikoo@1.3.0/dist/twikoo.all.min.js').then(()=> {
        init()
        bool && $countDom && setTimeout(getCount,0)
      })
    }
  }

  if ('Twikoo' === 'Twikoo' || !true) {
    if (true) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo(true)
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><script defer src="//lib.baomitu.com/jquery/3.5.1/jquery.min.js"></script><script defer src="https://myhkw.cn/api/player/160561664166" id="myhk" key="160561664166" m="1"></script><div><canvas id="snow" style="position:fixed;top:0;left:0;width:100%;height:100%;z-index:99999;pointer-events:none"></canvas></div><script>const notMobile = (!(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)));</script><scrip async type="text/javascript" src="https://cdn.jsdelivr.net/gh/Candinya/Kratos-Rebirth@latest/source/js/snow.min.js"></scrip><scrip defer src="https://cdn.jsdelivr.net/npm/hexo-theme-volantis@latest/source/js/issues.min.js"></scrip><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><script>var gitcalendar = new Vue({
  el: '#gitcalendar',
  data: {
    simplemode: true, 
    user: 'xiaoliblog',
    fixed: 'fixed',
    px: 'px',
    x: '',
    y: '',
    span1: '',
    span2: '',
    month: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
    monthchange: [],
    oneyearbeforeday: '',
    thisday: '',
    amonthago: '',
    aweekago: '',
    weekdatacore: 0,
    datacore: 0,
    total: 0,
    datadate: '',
    data: [],
    positionplusdata: [],
    firstweek: [],
    lastweek: [],
    beforeweek: [],
    thisweekdatacore: 0,
    mounthbeforeday: 0,
    mounthfirstindex: 0,
    crispedges: 'crispedges',
    thisdayindex: 0,
    amonthagoindex: 0,
    amonthagoweek: [],
    firstdate: [],
    first2date: [],
    montharrbefore: [],
    monthindex: 0,
    color: ['#ebedf0', '#f1f8ff', '#dbedff', '#c8e1ff', '#79b8ff', '#2188ff', '#0366d6', '#005cc5', '#044289', '#032f62', '#05264c']
  },
  methods: {
    selectStyle(data, event) {
      document.querySelector('.angle-wrapper').style.display = 'block'
      this.span1 = data.date;
      this.span2 = data.count;
      this.x = event.clientX - 100;
      this.y = event.clientY - 60
    },
    outStyle() {
      document.querySelector('.angle-wrapper').style.display = 'none'
    },
    thiscolor(x) {
      if (x === 0) {
        let i = parseInt(x / 2);
        return this.color[0]
      } else if (x < 2) {
        return this.color[1]
      } else if (x < 20) {
        let i = parseInt(x / 2);
        return this.color[i]
      } else {
        return this.color[9]
      }
    },
  }
});
var apiurl = 'python-github-calendar-api-ruby.vercel.app' ? 'https://python-github-calendar-api-ruby.vercel.app/api?' : 'https://githubapi.ryanchristian.dev/user/'
var githubapiurl = apiurl + gitcalendar.user;
//canvas绘图
function responsiveChart() {
  let c = document.getElementById("gitcanvas");
  if (c) {
    let cmessage = document.getElementById("gitmessage");
    let ctx = c.getContext("2d");
    c.width = document.getElementById("gitcalendarcanvasbox").offsetWidth;
    let linemaxwitdh = 0.96 * c.width / gitcalendar.data.length;
    c.height = 9 * linemaxwitdh;
    let lineminwitdh = 0.8 * linemaxwitdh;
    let setposition = {
      x: 0.02 * c.width,
      y: 0.025 * c.width
    };
    for (let week in gitcalendar.data) {
      weekdata = gitcalendar.data[week];
      for (let day in weekdata) {
        let dataitem = {
          date: "",
          count: "",
          x: 0,
          y: 0
        };
        gitcalendar.positionplusdata.push(dataitem);
        ctx.fillStyle = gitcalendar.thiscolor(weekdata[day].count);
        setposition.y = Math.round(setposition.y * 100) / 100;
        dataitem.date = weekdata[day].date;
        dataitem.count = weekdata[day].count;
        dataitem.x = setposition.x;
        dataitem.y = setposition.y;
        ctx.fillRect(setposition.x, setposition.y, lineminwitdh, lineminwitdh);
        setposition.y = setposition.y + linemaxwitdh
      };
      setposition.y = 0.025 * c.width;
      setposition.x = setposition.x + linemaxwitdh
    };
    ctx.font = "600  Arial";
    ctx.fillStyle = '#aaa';
    ctx.fillText("日", 0, 1.9 * linemaxwitdh);
    ctx.fillText("二", 0, 3.9 * linemaxwitdh);
    ctx.fillText("四", 0, 5.9 * linemaxwitdh);
    ctx.fillText("六", 0, 7.9 * linemaxwitdh);
    let monthindexlist = c.width / 24;
    for (let index in gitcalendar.monthchange) {
      ctx.fillText(gitcalendar.monthchange[index], monthindexlist, 0.7 * linemaxwitdh);
      monthindexlist = monthindexlist + c.width / 12
    };
    cmessage.onmousemove = function(event) {
      document.querySelector('.angle-wrapper').style.display = 'none'
    };
    c.onmousemove = function(event) {
      document.querySelector('.angle-wrapper').style.display = 'none'
      getMousePos(c, event);
    };

    function getMousePos(canvas, event) {
      var rect = canvas.getBoundingClientRect();
      var x = event.clientX - rect.left * (canvas.width / rect.width);
      var y = event.clientY - rect.top * (canvas.height / rect.height);
      //console.log("x:"+x+",y:"+y);
      for (let item of gitcalendar.positionplusdata) {
        let lenthx = x - item.x;
        let lenthy = y - item.y;
        //console.log(lenthx,lenthy);
        if (0 < lenthx && lenthx < lineminwitdh) {
          if (0 < lenthy && lenthy < lineminwitdh) {
            //console.log(item.date,item.count)
            document.querySelector('.angle-wrapper').style.display = 'block'
            gitcalendar.span1 = item.date;
            gitcalendar.span2 = item.count;
            gitcalendar.x = event.clientX - 100;
            gitcalendar.y = event.clientY - 60
          }
        }
        //if(0< x - item.x <lineminwitdh&&0< y - item.y <lineminwitdh){
        //console.log(item.count,item.date);
        //}
      }
    }
  }
}
//数据统计算法
function addlastmonth() {
  if (gitcalendar.thisdayindex === 0) {
    thisweekcore(52);
    thisweekcore(51);
    thisweekcore(50);
    thisweekcore(49);
    thisweekcore(48);
    gitcalendar.thisweekdatacore += gitcalendar.firstdate[6].count;
    gitcalendar.amonthago = gitcalendar.firstdate[6].date
  } else {
    thisweekcore(52);
    thisweekcore(51);
    thisweekcore(50);
    thisweekcore(49);
    thisweek2core();
    gitcalendar.amonthago = gitcalendar.first2date[gitcalendar.thisdayindex - 1].date
  }
};

function thisweek2core() {
  for (let i = gitcalendar.thisdayindex - 1; i < gitcalendar.first2date.length; i++) {
    gitcalendar.thisweekdatacore += gitcalendar.first2date[i].count
  }
};

function thisweekcore(index) {
  for (let item of gitcalendar.data[index]) {
    gitcalendar.thisweekdatacore += item.count
  }
};

function addlastweek() {
  for (let item of gitcalendar.lastweek) {
    gitcalendar.weekdatacore += item.count
  }
};

function addbeforeweek() {
  for (let i = gitcalendar.thisdayindex; i < gitcalendar.beforeweek.length; i++) {
    gitcalendar.weekdatacore += gitcalendar.beforeweek[i].count
  }
};

function addweek(data) {
  if (gitcalendar.thisdayindex === 6) {
    gitcalendar.aweekago = gitcalendar.lastweek[0].date;
    addlastweek()
  } else {
    lastweek = data.contributions[51];
    gitcalendar.aweekago = lastweek[gitcalendar.thisdayindex + 1].date;
    addlastweek();
    addbeforeweek()
  }
}

fetch(githubapiurl)
  .then(data => data.json())
  .then(data => {
    gitcalendar.data = data.contributions;
    gitcalendar.total = data.total;
    gitcalendar.first2date = gitcalendar.data[48];
    gitcalendar.firstdate = gitcalendar.data[47];
    gitcalendar.firstweek = data.contributions[0];
    gitcalendar.lastweek = data.contributions[52];
    gitcalendar.beforeweek = data.contributions[51];
    gitcalendar.thisdayindex = gitcalendar.lastweek.length - 1;
    gitcalendar.thisday = gitcalendar.lastweek[gitcalendar.thisdayindex].date;
    gitcalendar.oneyearbeforeday = gitcalendar.firstweek[0].date;
    gitcalendar.monthindex = gitcalendar.thisday.substring(5, 7) * 1;
    gitcalendar.montharrbefore = gitcalendar.month.splice(gitcalendar.monthindex, 12 - gitcalendar.monthindex);
    gitcalendar.monthchange = gitcalendar.montharrbefore.concat(gitcalendar.month);
    addweek(data);
    addlastmonth();
    responsiveChart();
  })
  .catch(function(error) {
    console.log(error);
  });

//手机版更换为svg绘制
if (document.getElementById("gitcalendarcanvasbox").offsetWidth < 500) {
  gitcalendar.simplemode = false
}

//当改变窗口大小时重新绘制canvas
window.onresize = function() {
  if (gitcalendar.simplemode) responsiveChart()
}

//解决滚动滑轮时出现的标签显示
window.onscroll = function() {
  if (document.querySelector('.angle-wrapper')) {
    document.querySelector('.angle-wrapper').style.display = 'none'
  }
};</script></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"log":false,"model":{"jsonPath":"/live2dw/assets/hijiki.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":true},"react":{"opacity":0.7}});</script></body></html>